﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YArchitech.LIB;

namespace YArchitech.Controls.HeaderGridView
{
	public partial class InputBox : System.Windows.Forms.Form
	{
		public string Msg
		{
			get
			{
				return this.msg;
			}
			set
			{
				this.msg = value;
				this.label1.Text = this.msg;
			}
		}

		public string SearchValue
		{
			get
			{
				return this.searchValue;
			}
			set
			{
				this.searchValue = value;
			}
		}

		public InputBox()
		{
			this.InitializeComponent();
			new YJKProcessTools().ShowInTaskbarChange(this);
		}

		private void btnOk_Click(object sender, EventArgs e)
		{
			if (this.txtInputBox.Text.Trim().Length == 0)
			{
				MessageBox.Show(this.msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				this.txtInputBox.Focus();
				base.DialogResult = DialogResult.None;
				return;
			}
			this.SearchValue = this.txtInputBox.Text;
			base.DialogResult = DialogResult.OK;
			base.Close();
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			base.DialogResult = DialogResult.Cancel;
			base.Close();
		}

		private void txtInputBox_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Return)
			{
				this.btnOk_Click(sender, e);
			}
		}

		private string searchValue = "";

		private string msg = "请输入要查找的内容！";
	}
}
